package com.m3839.operate.sdk;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.m3839.sdk.login.HykbLoginSDK;
import com.m3839.sdk.login.HykbUser;
import com.m3839.sdk.login.listener.HykbInitListener;
import com.m3839.sdk.login.listener.HykbLoginListener;


/**
 * @author chenbaoyang
 */
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void onInitClick(View view) {
        HykbLoginSDK.init(MainActivity.this, "3324",false, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, new HykbInitListener() {

            @Override
            public void onInitSuccess() {
                Toast.makeText(MainActivity.this, "初始化成功", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onInitFailed(final int code, final String msg) {
                Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
            }

        });
    }

    public void onLoginClick(View view) {
        HykbLoginSDK.login(MainActivity.this, new HykbLoginListener() {
            @Override
            public void onLoginSuccess(HykbUser user) {
                Toast.makeText(MainActivity.this, user.toString(), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onLoginFailed(int code, String message) {
                Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
            }
        });
    }
}
